import http from "../http"



/**
 * 新增公告
 * @returns
 */
export function addAnnouncement(params) {
    return http.post(`/announcement`, params, {
        msg: false,
        token:true,
        load:false
    });
}


/**
 * 修改公告
 * @returns
 */
export function putAnnouncement(params) {
    return http.put(`/announcement`, params, {
        msg: false,
        token:true,
        load:false
    });
}

/**
 * 获取所有公告
 * @param {number} page 页数
 * @param {number} size 每页数量
 * @returns
 */
export function getAllAnnouncement(page, size) {
    return http.get(`/announcement/all?page=${page}&size=${size}`,{
        msg: false,
        token:true,
        load:false
    });
}

/**
 * 删除公告
 * @param {string} id 公告id
 * @returns
 */
export function delAnnouncement(id) {
    return http.delete(`/announcement/${id}`,{
        msg: false,
        token:true,
        load:false
    });
}

/**
 * 发布公告
 * @returns
 */
export function publicAnnouncement(params) {
    return http.put(`/announcement/public`, params,{
        msg: false,
        token:true,
        load:false
    });
}

/**
 * 获取公告
 * @param {string} id
 * @returns
 */
export function getAnnouncement(id) {
    return http.get(`/announcement/${id}`, {
        msg: false,
        token:true,
        load:false
    });
}

/**
 * 获取公告
 * @param {number} userId
 * @param {string} annId
 * @returns
 */
export function getAnnouncement_1(userId, annId) {
    return http.get(`/announcement/ann?userId=${userId}&annId=${annId}`, {
        mag:false,
        token:true,
        load:false
    });
}